@using Microsoft.AspNetCore.Components.Web.Virtualization
<MudGrid>
    <MudItem xs="6">
        <MudText Typo="Typo.h6">Item provider</MudText>
        <MudVirtualize Enabled="true"
                       ItemsProvider="ServerDataFunc"
                       Context="itemBag">
            <Placeholder>
                <div id="item_provider_placeholder">Loading...</div>
            </Placeholder>
            <ChildContent>
                <div id="item_provider_content">[Content]</div>
            </ChildContent>
            <NoRecordsContent>
                <div id="item_provider_nodata">No data</div>
            </NoRecordsContent>
        </MudVirtualize>
    </MudItem>
    <MudItem xs="6">
        <MudText Typo="Typo.h6">Items virtualized</MudText>
        <MudVirtualize Enabled="true"
                       Items="_emptyList"
                       Context="itemBag">
            <Placeholder>
                <div id="items_virtualized_placeholder">Loading...</div>
            </Placeholder>
            <ChildContent>
                <div id="items_virtualized_content">[Content]</div>
            </ChildContent>
            <NoRecordsContent>
                <div id="items_virtualized_nodata">No data</div>
            </NoRecordsContent>
        </MudVirtualize>
    </MudItem>
    <MudItem xs="6">
        <MudText Typo="Typo.h6">Items</MudText>
        <MudVirtualize Enabled="false"
                       Items="_emptyList"
                       Context="itemBag">
            <Placeholder>
                <div id="items_placeholder">Loading...</div>
            </Placeholder>
            <ChildContent>
                <div id="items_content">[Content]</div>
            </ChildContent>
            <NoRecordsContent>
                <div id="items_nodata">No data</div>
            </NoRecordsContent>
        </MudVirtualize>
    </MudItem>
</MudGrid>

@code {
    public static string __description__ = @"The Virtualize component must show 'No data'.";

    private readonly List<VirtualizeModel> _emptyList = [];

    /// <summary>
    /// Reloads the data from the server, with support for cancellation.
    /// </summary>
    private static ValueTask<ItemsProviderResult<VirtualizeModel>> ServerDataFunc(ItemsProviderRequest request)
    {
        return ValueTask.FromResult(new ItemsProviderResult<VirtualizeModel>([], 0));
    }

    public record VirtualizeModel(int Index, string Column2);
}